// http.js
import axios from 'axios';
const http = axios.create({
    baseURL:process.env.VUE_APP_BASE_API,

    headers: {
        'Content-Type':'application/json;charset=UTF-8',
        'Content-Type':'application/x-www-form-urlencoded',
    },
    timeout: 8000
})

// 请求拦截器
http.interceptors.request.use(config => {
    config.headers.token = 'token';
    return config
})

// 响应拦截器
http.interceptors.response.use(res => {
    console.log(res)
    if(res.status == 200){
        console.log("请求成功")
    }
    return res.data
}, (err) => {
    // console.log(err)
    return Promise.reject(err)
})
export default http;